<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" title="模板" id="operateNumTpl">
	{{# if(d.type == 1){ }}
    	<span class="green">+{{ d.operate_num }}</span>
	{{# }else{ }}
		<span class="red">-{{ d.operate_num }}</span>
	{{# } }}
</script>

<script type="text/html" id="updateTimeTpl">
    <div>{{layui.util.toDateString(d.update_time * 1000) }}</div>
</script>

<script type="text/javascript">
    layui.use(['table', 'tool'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url("", ["id" => $id,"material_id" => $material_id])}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
				{field: 'id', title: 'ID',width:60}
                ,{field: 'update_time', title: '操作时间',templet: '#updateTimeTpl',width: 150}
                ,{field: 'factory_name', title: '工厂'}
                ,{field: 'client_ordernum', title: '订单号',templet:function(d){return '<span class="copy-item">'+d.client_ordernum+'</span>'}}
				,{field: 'caigou_number', title: '采购批号',templet:function(d){ return '<span class="copy-item">'+d.caigou_number+'</span>'}}
                ,{field: 'remark', title: '备注'}
                ,{field: 'operate_num', title: '操作量', templet:"#operateNumTpl"}
				,{field: 'create_admin', title: '操作人'}
            ]]
        });
    });
</script>